I'm trying to learn assembly and I'm trying to covert a function using inline assembly. The function I want to convert is the following:

Code:
void no_asm_ver() {
  int first_number = 0, second_number = 1, third_number, i;

  for(i = 2; i < 20; ++i) {
    third_number = first_number + second_number;
    printf("%d ", third_number);
    first_number = second_number;
    second_number = third_number;
  } fflush(stdout); write(1, "\n", 1);
}
So I want to convert this to assembly (except for the loop and the last line where it flushes "stdout" and prints a newline). I tried to do the following:

Code:
void asm_ver() {
  const void* prompt = "%d ";
  asm (
    "mov $0, %r15;" // frist_number
    "mov $1, %r14;" // second_number
    // "mov $0, %r13;" // third_number
  );

  int i;

  for(i = 2; i < 20; ++i) {
    asm volatile (
      // third_number = first_number + second_number
      "mov %r15, %r13;"
      "add %r14, %r13;"

      // printf("%d", third_number);
      "mov %r13, %rsi;"
      "call printf;"

      // first_number = second_number
      "mov %r14, %r15;"

      // second_number = third_number
      "mov %r13, %r14;"

      :: "D" (prompt)
    );
  } fflush(stdout); write(1, "\n", 1);
}
I've used "r13-r15" for the variables. For "printf", I've seen a post (link in the bottom of this post) about the calling convention for functions so I'm trying to pass the first parameter (prompt) in the "rdi" register and the second parameter (third_num) in the "rsi" register and then call "printf". If I remove the last line from the "asm" statement (:: "D" (prompt)) then it will work. But now, I'm getting the following error message in GCC:

Code:
test.c: In function ‘asm_ver’:
test.c:67:5: error: invalid 'asm': operand number out of range
   67 |     asm volatile (
      |     ^~~
test.c:67:5: error: invalid 'asm': operand number out of range
test.c:67:5: error: invalid 'asm': operand number out of range
test.c:67:5: error: invalid 'asm': operand number out of range
test.c:67:5: error: invalid 'asm': operand number out of range
test.c:67:5: error: invalid 'asm': operand number missing after %-letter
test.c:67:5: error: invalid 'asm': operand number out of range
test.c:67:5: error: invalid 'asm': operand number out of range
test.c:67:5: error: invalid 'asm': operand number out of range
test.c:67:5: error: invalid 'asm': operand number out of range

In TCC, the message is the following:

Code:
test.c:83: error: invalid operand reference after %
So none of them are very informative about what I'm doing wrong. Any ideas? Is there a chane that it doesn't like that I'm using the "r" registers...

Link for the post talking about the calling conversion: X86-64 assembly from scratch - Conrad Kleinespel